import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';

import {Routes, RouterModule} from '@angular/router'
import {PostlistService} from "./postlist/services/postlist.service";
import {FormsModule} from '@angular/forms'
import {PaginatorModule} from 'primeng/components/paginator/paginator';
import {PostDetailMainComponent} from "./post-detail-main/post-detail-main.component";
import {AddCommentComponent} from "../comment/add-comment/add-comment.component";
import {CommentService} from "../comment/services/comment.service";
import {PostDetailService} from "./post-detail/services/post-detail.service";
import {PostDetailComponent} from "./post-detail/post-detail.component";
import {AboutComponent} from "../about/about.component";
import {SharedModule} from "../shared/shared.module";
import {WritePostComponent} from "./write-post/write-post.component";
import {WritePost1Component} from './write-post1/write-post1.component';
import {PostlistComponent} from './postlist/postlist.component';

const postRoutes: Routes = [
  {
    path: '',
    redirectTo: 'page/1',
    pathMatch: 'full'
  },
  {
    path: 'page/:page',
    component: PostlistComponent
  },
  {
    path: 'postdetail/:postId',
    component: PostDetailMainComponent
  },
  {
    path: 'write',
    component: WritePostComponent
  },
  {
    path: 'write1',
    component: WritePost1Component
  }
]

@NgModule({
  imports: [
    PaginatorModule,
    SharedModule,
    RouterModule.forChild(postRoutes)
  ],
  declarations: [
    PostlistComponent,
    PostDetailMainComponent,
    PostDetailComponent,
    AddCommentComponent,
    WritePostComponent,
    WritePost1Component
  ],
  providers: [
    PostlistService,
    CommentService
  ]
})
export class PostModule {
}
